package com.guigu.tms.aggregation.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guigu.tms.aggregation.mapper.*;
import com.guigu.tms.commons.aggregation.entity.*;
import com.guigu.tms.aggregation.service.IOrderClassifyOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 订单分类订单关联表 服务实现类
 * </p>
 *
 * @author wj
 * @since 2022-10-21
 */
@Service
public class OrderClassifyOrderServiceImpl extends ServiceImpl<OrderClassifyOrderMapper, OrderClassifyOrder> implements IOrderClassifyOrderService {

    @Autowired
    OrderClassifyOrderMapper orderClassifyOrderMapper;

    @Autowired
    OrderClassifyMapper orderClassifyMapper;

    @Autowired
    OrderLocationMapper orderLocationMapper;

    @Autowired
    TaskPickupDispatchMapper taskPickupDispatchMapper;

    @Override
    public List<OrderClassifyOrder> ShowOrderClassifyOrder(String tripsId) {
        return orderClassifyOrderMapper.ShowOrderClassifyOrder(tripsId);
    }

    @Override
    public OrderClassify ShowOrderClassify(String orderClassifyId) {
        QueryWrapper<OrderClassify> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("id",orderClassifyId);
        return orderClassifyMapper.selectOne(queryWrapper);
    }

    @Override
    public OrderLocation ShowOrderLocation(String orderId) {
        QueryWrapper<OrderLocation> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("order_id",orderId);
        return orderLocationMapper.selectOne(queryWrapper);
    }

    @Override
    public int AddTaskPickupDispatch(TaskPickupDispatch taskPickupDispatch) {
        return taskPickupDispatchMapper.insert(taskPickupDispatch);
    }
}
